home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / hash.zip / LIST.2 < prev    next >
Text File  |  1993-01-04  |  907b  |  25 lines

  1.       Function h( KEY: string4 ): integer;
  2.          Type
  3.             KEY_types = (char_KEY, integer_KEY);
  4.             KEY_overlay = record
  5.                case KEY_types of
  6.                   char_KEY:    ( KEY_in_characters: string4 );
  7.                   integer_KEY: ( dummy: byte; {takes up room for string size}
  8.                                  integer_KEY_1: integer; {first 2 bytes of KEY}
  9.                                  integer_KEY_2: integer; {last 2 bytes of KEY}
  10.                                 );
  11.             end;
  12.  
  13.          Var
  14.             KEY_record: KEY_overlay;
  15.          begin {hash}
  16.          with KEY_record do
  17.             begin
  18.                KEY_in_characters := '    '; {clean out in case KEY < 4 chars}
  19.                KEY_in_characters := KEY;
  20.                h := ( integer_KEY_1 xor integer_KEY_2 ) mod number_TAB_entries;
  21.             end;
  22.          end; {hash}
  23.  
  24.  
  25.